require "Tile"


Grid = {}

Grid.new = function( pos, dimension_x, dimension_y )
	local self = {}
	
	
	for i = 0, dimension_x, 1
		
		self[i] = {}
		
		for j = 0, dimension_y, 1
			
			local temp_pos = {}
			
			temp_pos.x = i
			temp_pos.y = j
			
			self[i][j] = Tile.new( temp_pos, math.random(Tile.Type.Min,Tile.Type.Max) )
			
		end
		
	end
	
	self.sizeX = dimension_x
	self.sizeY = dimension_y
	
	self.get = function( x, y )
		
		if x < self.sizeX and y < self.sizeY
			
			return self[x][y] 
			
		end
		
		return nil
	end
	
	return self
end